#include <iostream>

#include "array.h"

using namespace std;

ostream &operator <<(ostream &os, const Array &array) {
	os << "{";
	for (int i = 0; i < array.length(); i++)
		os << array.buffer[i] << (i < array.length()-1 ? ", " : "");
	os << "}";
	return os;
}

Array::Array(int n, int *arr) : n(n), buffer(new int[n]) {
	for (int i = 0; i < n; i++)
		buffer[i] = arr ? arr[i] : 0;
}

ostream &operator <<(ostream &os, const ArrayIterator &array) {
	os << array.current;
	return os;
}

ArrayIterator ArrayIterator::operator ++() {
	current++;
	return *this;
}
